// taking all the code out from he index.html 
// try to com with the main using ipc 
const { ipcRenderer } = window.require('electron')
const MarkdownIt = window.require('markdown-it')
const md = new MarkdownIt()

// @TODO add a store to remember the last open file 

const target = document.getElementById('rendered-area')

target.innerHTML = '<b>Use the menu to open a file</b>'
            

ipcRenderer.on('FILE_OPEN', (event, args) => {
  console.log('got FILE_OPEN', event, args)
  let result = md.render(args)

  target.innerHTML = result 
})